{% extends "基础.html" %}

{% block 标题 %}
  草蟒问答 - 详情
{% endblock %}

{% block 头部 %}
  
{% endblock %}

{% block 主体 %}
<div class="mx-5 bg-light">
    <h2 class="mb-1 text-primary text-center">{{ 问题.标题 }}</h2>
    <p class="text-center">作者: {{ 问题.发布者.用户名 }} 时间: {{ 问题.发布时间 }}</p>
    <hr>
    <div class="mb-1">{{ 问题.内容 }}</div>
    <hr>
</div>
<div class="list-group mx-5">
    <p>评论：({{ 评论々 | 长度 }})</p>
    <form method="post" action="{{ 构造url('问答.评论', 问题id=问题.id) }}">
        {{ 表单.csrf_token }}
      <div class="mb-3 d-grid">
        <textarea name="内容" rows="4" placeholder="请输入评论..." class="form-control"></textarea>
      </div>
      <div class="text-end mb-5">
        <button type="submit" class="btn btn-primary">发布</button>
      </div>
    </form>
    {% if 评论々 | 长度 %}
    {% for 评论 in 评论々 %}
      <div class="list-group-item list-group-item-action mb-3" aria-current="true">
        <div class="d-flex w-100 justify-content-between">
          <small>
            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-emoji-heart-eyes" viewBox="0 0 16 16">
              <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
              <path d="M11.315 10.014a.5.5 0 0 1 .548.736A4.498 4.498 0 0 1 7.965 13a4.498 4.498 0 0 1-3.898-2.25.5.5 0 0 1 .548-.736h.005l.017.005.067.015.252.055c.215.046.515.108.857.169.693.124 1.522.242 2.152.242.63 0 1.46-.118 2.152-.242a26.58 26.58 0 0 0 1.109-.224l.067-.015.017-.004.005-.002zM4.756 4.566c.763-1.424 4.02-.12.952 3.434-4.496-1.596-2.35-4.298-.952-3.434zm6.488 0c1.398-.864 3.544 1.838-.952 3.434-3.067-3.554.19-4.858.952-3.434z"/>
            </svg>
            {{ 评论.评论者.用户名 }}
          </small>
          <small>{{ 评论.评论时间 }}</small>
        </div>
        <p class="mb-1 text-success">{{ 评论.内容 }}</p>
      </div>
    {% endfor %}
    {% endif %}
  </div>
{% endblock %}